package org.easy.tool.controller;

import org.easy.tool.common.R;
import org.easy.tool.service.IProblem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;

/**
 * 处理题目
 *
 * @author Valley
 * @since 2024-09-04 22:51:14
 */
@RestController
@RequestMapping("/problem")
@CrossOrigin
public class ProblemController {

    @Autowired
    IProblem service;


    @RequestMapping("submitProblem")
    public R submitProblem(@RequestBody(required = false) LinkedHashMap data) throws Exception {
        return R.ok(service.submitProblem(data));
    }


    @RequestMapping("getProblemList")
    public R getProblemList(@RequestBody(required = false) LinkedHashMap data) throws Exception {
        return R.ok(service.getProblemList());
    }

    @RequestMapping("deleteProblem")
    public R deleteProblem(@RequestBody(required = false) LinkedHashMap data) throws Exception {
        return R.ok(service.deleteProblem(data));
    }


}
